<?php

namespace application\model;

use application\entity\db\IData;
use application\model\BaseModel;
use core\entity\Criteria;

class IDataModel extends BaseModel {

    public function __construct() {
        parent::__construct(IData::class);
    }

    /**
     * Kiểm tra danh mục tồn tại
     * @param type $categoryId
     * @return type
     */
    public function exitsByCategiryId($categoryId) {
        $cri = new Criteria();
        $cri->andKey("categoryId")->is($categoryId);
        return $this->icount($cri) != 0;
    }

    /**
     * Kiểm tra seo url
     * @param type $seoUrl
     * @return type
     */
    public function exitBySeoUrl($seoUrl) {
        $cri = new Criteria();
        $cri->andKey("seoUrl")->is($seoUrl);
        return $this->icount($cri) > 0;
    }

}
